from app import db


class Experiment(db.Model):
    __tablename__ = 'tbl_experiment'

    Ex_id = db.Column(db.String(10), primary_key=True)
    Cos_id = db.Column(db.String(10), nullable=False)
    Ex_req = db.Column(db.String, nullable=True)
    Ex_ddl = db.Column(db.DateTime(), nullable=True)
    Ex_address = db.Column(db.String(200), nullable=True)

    def to_json(self):
        return {
            "Ex_id": self.Ex_id,
            "Cos_id": self.Cos_id,
            "Ex_req": self.Ex_req,
            "Ex_ddl": str(self.Ex_ddl),
            "Ex_address": self.Ex_address
        }
